Checkpoint NEWQ code. Still not very happy with it. It's exposing all kinds
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 12 Aug 2013 20:49:53 +0000 (20:49 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 12 Aug 2013 20:49:53 +0000 (20:49 +0000)
of ugliness.

git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4530 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/filterdefs.h
gpsbabel/netstumbler.cc
gpsbabel/transform.cc
gpsbabel/waypt.cc

index 6af9a747fd38301cdaab5cdba4f648d3124c46a9..9650a2467343940a06d0595e1fc597b78ba02703 100644 (file)
@@ -27,6 +27,9 @@
  */
 
 extern queue waypt_head;
+#if NEWQ
+extern QList<waypoint*> waypt_list;
+#endif
 
 typedef struct filter_vecs {
   filter_init f_init;
index f4140dc3ff4f6a71978cb5da208e04c192a41488..a48ea91937a88175def7f67621fecf8fc2501314 100644 (file)
@@ -292,8 +292,6 @@ fix_netstumbler_dupes(void)
 {
   int i, ct = waypt_count(), serial = 0;
   htable_t* htable, *bh;
-  queue* elem, *tmp;
-  extern queue waypt_head;
   const char* snptr;
   char* tmp_sn;
   unsigned long last_crc;
@@ -303,8 +301,18 @@ fix_netstumbler_dupes(void)
   bh = htable;
 
   i = 0;
+#if NEWQ
+  // Why, oh, why is this format running over the entire waypoint list and
+  // modifying it?  This seems wrong.
+  extern QList<waypoint*> waypt_list;
+  foreach(waypoint* waypointp, waypt_list) {
+    bh->wpt = waypointp;
+#else
+  queue* elem, *tmp;
+  extern queue waypt_head;
   QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
     bh->wpt = (waypoint*) elem;
+#endif
     snptr = bh->wpt->shortname;
     tmp_sn = strlower(xstrdup(snptr));
     bh->crc = get_crc32(tmp_sn, strlen(snptr));
index a8e57e20790e0be9e908ae69a9b2ddbf70578d8e..f70e25e414d2052c5b7c6daffffdde02d0e1d3be 100644 (file)
@@ -59,7 +59,6 @@ arglist_t transform_args[] = {
 static void
 transform_waypoints(void)
 {
-  queue *elem, *tmp;
   route_head *rte;
 
   rte = route_head_alloc();
@@ -71,9 +70,13 @@ transform_waypoints(void)
     track_add_head(rte);
     break;
   }
-
+#if NEWQ
+  foreach(waypoint* wpt, waypt_list) {
+#else
+  queue *elem, *tmp;
   QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
     waypoint *wpt = (waypoint *) elem;
+#endif
 
     wpt = waypt_dupe(wpt);
     switch (current_target) {
index 2a3ef1ee5cce3f51ce160535970648b82d4eb4b9..a990b8a5fdc1ee87bfaf3af0cf2976dc6fc284f4 100644 (file)
@@ -30,8 +30,6 @@
 #include "garmin_fs.h"
 #include "session.h"
 
-#define NEWQ 0  // Work in progress.
-
 #if NEWQ
 QList<waypoint*> waypt_list;
 queue waypt_head; // This is here solely to freak out the formats that are 
@@ -54,7 +52,9 @@ void
 waypt_init(void)
 {
   mkshort_handle = mkshort_new_handle();
-#if !NEWQ
+#if NEWQ
+  waypt_list.clear();
+#else
   QUEUE_INIT(&waypt_head);
 #endif
 }
@@ -433,14 +433,17 @@ waypt_free(waypoint *wpt)
   delete wpt;
 }
 
-void
-waypt_flush(queue *head)
-{
 #if NEWQ
-  foreach(waypoint* q, waypt_list) {
-    waypt_free(q);
+void
+waypt_flush(queue* head) {
+  while (!waypt_list.isEmpty()) {
+    waypt_free(waypt_list.takeFirst());
   }
+}
 #else
+void
+waypt_flush(queue *head)
+{
   queue *elem, *tmp;
 
   QUEUE_FOR_EACH(head, elem, tmp) {
@@ -450,8 +453,8 @@ waypt_flush(queue *head)
       waypt_ct--;
     }
   }
-#endif
 }
+#endif
 
 void
 waypt_flush_all()
@@ -475,8 +478,8 @@ waypt_backup(signed int *count, queue **head_bak)
   qbackup = (queue *) xcalloc(1, sizeof(*qbackup));
   QUEUE_INIT(qbackup);
 #if NEWQ
-// Why doe sthis code exist?
-abort();
+// Why doethis code exist?
+//abort();
 #else
   QUEUE_MOVE(qbackup, &waypt_head);
   QUEUE_INIT(&waypt_head);
@@ -502,7 +505,7 @@ waypt_restore(signed int count, queue *head_bak)
   }
 
 #if NEWQ
-abort();
+//abort();
 #else
   waypt_flush(&waypt_head);
   QUEUE_INIT(&waypt_head);